package model.newhouse.mapper;

import model.newhouse.entity.Newhouse;
import org.apache.ibatis.annotations.*;


import java.util.List;
@Mapper
public interface NewhouseMapper {

    //    增
    @Insert("insert into newhouse values(#{newhouseId},#{newhouseName},#{newhouseSalesmanid},#{newhouseSalesmanname},#{newhouseAvgprice},#{newhouseHousearea},#{newhouseType},#{newhousePictureid},#{newhouseTime})")
    void save(Newhouse newhouse);

//    删
    @Delete("delete from newhouse where newhouseId = #{id}")
    void  del(String newhouseId);

//    改
    @Update("update newhouse set newhouseId=#{newhouseId},newhouseName=#{newhouseName},newhouseSalesmanid=#{newhouseSalesmanid},newhouseSalesmanname=#{newhouseSalesmanname},newhouseAvgprice=#{newhouseAvgprice},newhouseHousearea=#{newhouseHousearea},newhouseType=#{newhouseType},newhousePictureid=#{newhousePictureid},newhouseTime=#{newhouseTime}")
    void update(Newhouse newhouse);
//    查

    @Select("select * from newhouse")
    List<Newhouse> findAll();

    @Select("select * from newhouse where newhouse_metro= #{newhouseMetro} and  newhouse_school= #{newhouseSchool} and newhouse_commerce= #{newhouseCommerce}")
    List<Newhouse> findByMetro(String newhouseMetro,String newhouseSchool,String newhouseCommerce);

//    @Select("select * from newhouse where newhouseMetro = #{newhouseMetro}")
//    List<Newhouse> findByMetro(String newhouseMetro);
//
//    @Select("select * from newhouse where newhouseSchool = #{newhouseSchool}")
//    List<Newhouse> findBySchool(String newhouseSchool);
//
//    @Select("select * from newhouse where newhouseCommerce = #{newhouseCommerce}")
//    List<Newhouse> findByCommerce(String newhouseCommerce);
}
